import Taro, { Component } from '@tarojs/taro'
import { Provider } from '@tarojs/mobx'
import Index from './pages/index'

import store from './store/index'

import './app.scss'
import 'taro-ui/dist/style/index.scss' // 全局引入一次即可
import "taro-ui/dist/style/components/grid.scss";
import "taro-ui/dist/style/components/tabs.scss";
import './utils/utils';
import '../src/styles/theme.scss';

// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

// const store = {
//   counterStore
//
// }

class App extends Component {

  config = {
    pages: [
      // 'pages/myShopPage/myShopPage',
      'pages/homePage/homePage',
      'pages/classifyPage/classifyPage',
      'pages/explosivePage/explosivePage',
      'pages/myShopPage/myShopPage',
      'pages/myPage/myPage',
      'pages/detailPage/detailPage',
      'pages/myWebView/myWebView',
      'pages/hotSearchPage/hotSearchPage',
      'pages/goldPage/goldPage',
      // 'pages/index/index',
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black'
    },
    tabBar: {
      color: "#666",
      selectedColor: "#b4282d",
      backgroundColor: "#fafafa",
      borderStyle: 'black',
      list: [{
        pagePath: "pages/homePage/homePage",
        iconPath: "./asset/images/tabBar/home.png",
        selectedIconPath: "./asset/images/tabBar/home-active.png",
        text: "首页"
      }, {
        pagePath: "pages/classifyPage/classifyPage",
        iconPath: "./asset/images/tabBar/grid.png",
        selectedIconPath: "./asset/images/tabBar/grid-active.png",
        text: "分类"
      }, {
        pagePath: "pages/explosivePage/explosivePage",
        iconPath: "./asset/images/tabBar/fire.png",
        selectedIconPath: "./asset/images/tabBar/fire-active.png",
        text: "爆款"
      }, {
        pagePath: "pages/myShopPage/myShopPage",
        iconPath: "./asset/images/tabBar/shop.png",
        selectedIconPath: "./asset/images/tabBar/shop-active.png",
        text: "抖货"
      },
        // {
        //   pagePath: "pages/myPage/myPage",
        //   iconPath: "./asset/images/tabBar/user.png",
        //   selectedIconPath: "./asset/images/tabBar/user-active.png",
        //   text: "陶礼金"
        // },
        {
          pagePath: "pages/goldPage/goldPage",
          iconPath: "./asset/images/tabBar/gold.png",
          selectedIconPath: "./asset/images/tabBar/gold-active.png",
          text: "福利商品"
        },
      ]
    }
  }

  componentDidMount () {
    //云函数（屏蔽）
    if(process.env.TARO_ENV === 'weapp'){
        wx.cloud.init({
          traceUser: true,
        })
    }
  }

  componentDidShow () {

  }

  componentDidHide () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Provider store={store}>
        <Index />
      </Provider>
    )
  }
}

Taro.render(<App />, document.getElementById('app'))
